<?PHP
function OpenTPL_function_repeat( $string, $addstr, $length = 0, $prepend = 'FALSE' ) {
    if( $length < 1 ) {
        return $string;
    }
    $repeat = $length - strlen( $string );
    //满足追加条件
    if( $repeat ) {
        $added = str_repeat( $addstr, $repeat );
        // 追加
        if( strtoupper( $prepend ) == 'FALSE' ) {
            $string .= $added;
        } else {
            $string = $added . $string;
        }
    }
    return $string;
}
?>